﻿namespace Basic.EventBus.Attributes;

[AttributeUsageAttribute(AttributeTargets.Class, Inherited = true, AllowMultiple = false)]
public class EventSubscriberAttribute : Attribute
{
    public Type DataType { get; set; }

    /// <summary>
    /// 并发数量
    /// </summary>
    public ushort ConcurrencyNumber { get; set; } = 4;

    public bool AutoAck { get; set; }

    private EventTopicAttribute _topicObj;
    public EventTopicAttribute TopicObj => _topicObj ??= EventTopicAttribute.GetCurrentAttribute(DataType);

    public string QueueName
    {
        get => TopicObj?.QueueName;
        set => TopicObj.QueueName = value;
    }
}